using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication11.Models.Mapping
{
    public class follow_up_frequencyMap : EntityTypeConfiguration<follow_up_frequency>
    {
        public follow_up_frequencyMap()
        {
            // Primary Key
            this.HasKey(t => t.follow_up_frequency_id);

            // Properties
            this.Property(t => t.frequency_desc)
                .HasMaxLength(50);

            this.Property(t => t.frequency_type)
                .IsRequired()
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("follow_up_frequency");
            this.Property(t => t.follow_up_frequency_id).HasColumnName("follow_up_frequency_id");
            this.Property(t => t.bp_group_id).HasColumnName("bp_group_id");
            this.Property(t => t.patient_group).HasColumnName("patient_group");
            this.Property(t => t.frequency_desc).HasColumnName("frequency_desc");
            this.Property(t => t.frequency_type).HasColumnName("frequency_type");
            this.Property(t => t.frequency).HasColumnName("frequency");

            // Relationships
            this.HasRequired(t => t.bp_group_para)
                .WithMany(t => t.follow_up_frequency)
                .HasForeignKey(d => d.bp_group_id);

        }
    }
}
